<script type="text/javascript">
    {literal}
        $(document).ready(function() {
            $("#fulltext").keyup(function(event){
                if(event.keyCode == 13){
                    setFulltext($('#fulltext').val(),'list_of_tariffs_fulltext')
                }
            });
            $("#fulltext").focus();
        });
    {/literal}
</script>
<div class="content">
    <ul class="subNavig">
        <li><a href="{$data.root}?input=list_of_clients">Clients</a></li>
        <li><a href="{$data.root}?input=list_of_users">Users</a></li>
        <li><a href="{$data.root}?input=list_of_tariffs">Tariffs</a></li>
    </ul>
    <h2 class="pageTitle">List of tariffs</h2>
    {include $data.pathToError}
    {if $data.currentFilter || $data.currentFulltext!=''}
        <div class="menu-list bgDark">
            <b>Current filter:</b> 
            <ul>
                {foreach $data.currentFilter as $filter => $value}
                    <li>{$filter} = <i>{$value}</i> [<a href="javascript: cancelFilter('{$filter}','list_of_tariffs_filter')" class="baseLink">Cancel</a>]</li>
                {/foreach}
                {if $data.currentFulltext != ''}
                    <li>Fulltext = <i>{$data.currentFulltext}</i> [<a href="javascript: cancelFulltext('list_of_tariffs_fulltext')" class="baseLink">Cancel</a>]</li>
                {/if}
            </ul>
        </div>
    {/if}
    <div class="menu-list">
        Fulltext search: <input id="fulltext" type="text" value="{if $data.currentFulltext != ''}{$data.currentFulltext}{/if}" /><input value="Search" type="button" onclick="setFulltext($('#fulltext').val(),'list_of_tariffs_fulltext')" />
    </div>
    <form action="{$data.root}?input=list_of_tariffs" method="post" id="addingUser">
         {*<div class="menu-list">
           <select name="action" onchange="submitForm('addingUser')">
                <option value="">Actions ...</option>
                <option value="deleteTariffs">Delete tariff(s)</option>
            </select>
        </div>*}
        <table class="list">
            <tr>
                {*<th><input type="checkbox" id="checkAll" onchange="checkIt('checkAll')" /></th>*}
                <th><a href="javascript: order('title','list_of_tariffs_order')">Title {if $data.currentOrder.0=="title"}<img src="{$data.root}images/{$data.currentOrder.1}.png" height="14" width="14" />{/if}</a></th>
                <th><a href="javascript: order('tariff','list_of_tariffs_order')">Tariff {if $data.currentOrder.0=="tariff"}<img src="{$data.root}images/{$data.currentOrder.1}.png" height="14" width="14" />{/if}</a></th>
                <th><a href="javascript: order('servis_tariff','list_of_tariffs_order')">Servis tariff {if $data.currentOrder.0=="servis_tariff"}<img src="{$data.root}images/{$data.currentOrder.1}.png" height="14" width="14" />{/if}</a></th>
                <th><a href="javascript: order('unit','list_of_tariffs_order')">Unit {if $data.currentOrder.0=="unit"}<img src="{$data.root}images/{$data.currentOrder.1}.png" height="14" width="14" />{/if}</a></th>
                <th><a href="javascript: order('type_of_record','list_of_tariffs_order')">Type of record {if $data.currentOrder.0=="type_of_record"}<img src="{$data.root}images/{$data.currentOrder.1}.png" height="14" width="14" />{/if}</a></th>
                <th><a href="javascript: order('description','list_of_tariffs_order')">Description {if $data.currentOrder.0=="description"}<img src="{$data.root}images/{$data.currentOrder.1}.png" height="14" width="14" />{/if}</a></th>
            </tr>
            {assign var=counter value=1}
            {foreach $data.tariffs as $key => $tariff}
                {if $counter==1}
                    {assign var=bgClass value='bgDark'}
                {else}
                    {assign var=bgClass value='bgLight'}
                {/if}
                <tr class="{$bgClass}">
                    {if $counter==1}
                        {assign var=counter value=2}
                    {else}
                        {assign var=counter value=1}
                    {/if}
                    {*<td>
                        <input name="tariffId[]" value="{$tariff.Id}" class="userselector" type="checkbox" />
                    </td>*}
                    <td style="width: 170px;">{*<a class="filterLink" href="{$data.root}?input=edit_tariff&tariff={$tariff.Id}">*}{$tariff.title}{*</a>*}</td>
                    <td><a class="filterLink" href="javascript: filter('tariff','{$tariff.tariff}','list_of_tariffs_filter')">{$tariff.tariff}</a></td>
                    <td><a class="filterLink" href="javascript: filter('servis_tariff','{$tariff.servis_tariff}','list_of_tariffs_filter')">{$tariff.servis_tariff}</a></td>
                    <td><a class="filterLink" href="javascript: filter('unit','{$tariff.unit}','list_of_tariffs_filter')">{$tariff.unit}</a></td>
                    <td><a class="filterLink" href="javascript: filter('type_of_record','{$tariff.type_of_record}','list_of_tariffs_filter')">{$tariff.type_of_record_info.type_of_record}</a></td>
                    <td style="text-align: left; width: 450px; ">{$tariff.description}</td>
                </tr>
            {/foreach}
        </table>
    </form>
    <div class="menu-list">
        <span class="pager">{$data.pager}</span>
        Records per page
        <select class="pager" size="1" onchange="changeRecordsPerPage(this.value, 'list_of_tariffs_pager')">
            <option {if $smarty.session.list_of_tariffs_pager==10}selected="selected"{/if} value="10">10</option>
            <option {if $smarty.session.list_of_tariffs_pager==20}selected="selected"{/if} value="20">20</option>
            <option {if $smarty.session.list_of_tariffs_pager==50}selected="selected"{/if} value="50">50</option>
        </select>
        Count: {$data.total_count}
    </div>
</div>